package manufacturerbeans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class ProductTable implements Serializable{
    
    private ProductDataModel productDataModel;
    private Product selectedProduct;

    public ProductTable() {

        List<Product> products = new ArrayList<Product>();
        for (int i = 0; i < 10; i++) {
            String id=UUID.randomUUID().toString().substring(0, 8);  
            products.add(new Product(id));
        }
        productDataModel = new ProductDataModel(products);
    }

    public Product getSelectedProduct() {
        return selectedProduct;
    }

    public void setSelectedProduct(Product selectedProduct) {
        this.selectedProduct = selectedProduct;
    }

    public ProductDataModel getProducts() {
        return productDataModel;
    }   
}
